﻿Imports Training.Common

Partial Public Class PasswordRequest
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    ''' <summary>
    ''' Request button click event
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks>Check for valid page, send email request</remarks>
    Private Sub btnRequest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRequest.Click
        If Page.IsValid Then
            EmailRequest()
            requests.Visible = False
            lblReply.Text = "Your request has been sent.<br />An administrator will contact you."
        Else
            lblReply.Text = "Error validating input. Please try again."
        End If
    End Sub

    ''' <summary>
    ''' Send request for password change to admin
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub EmailRequest()
        SendEmail("you@yourdomain.com", "Training user password request", "The user <b>" & tbEmail.Text & "</b> has requested a new password.")
    End Sub
End Class